# Maintainer: Leonard Kong  <kongliangwp@outlook.com>
# Contributor: atzlinux

_pkgbase=stmmac-phytium
pkgname=${_pkgbase}
_pkgname=${pkgname%-dkms}
pkgver=0.1
pkgrel=1
pkgdesc="stmmac driver for phytium platform notebooks (DKMS)"
arch=('aarch64')
license=('GPL2')
depends=('dkms')
conflicts=("${_pkgbase}")
source=('stmmac-phytium-0.1.tar.gz'
        'dkms.conf')
md5sums=('70d8b7597d465862045d6716cfccd425'
         '4c680be90992f92268338fb6785b8f2a')

build() {

  cd ${_pkgbase}-${pkgver}

  # Build
  make
}
package() {

  # Copy dkms.conf
  install -Dm644 dkms.conf "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/dkms.conf

  # Set name and version
  sed -e "s/@_PKGBASE@/${_pkgbase}/" \
      -e "s/@PKGVER@/${pkgver}/" \
      -i "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/dkms.conf

  # Copy sources (including Makefile)
  cp -r ${_pkgbase}-${pkgver}/* "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/
}
